
$("#account").focus();
$("#account").click(
	function() {
		$("#account-message").html('&#160;');
		$("#account-message").css({'background-color':'#627b89'});
	}
);
$("#password").click(
		function() {
			$("#account-message").html('&#160;');
			$("#account-message").css({'background-color':'#627b89'});
		}
	);

$("#loginForm").submit(function() {
	if ($("#account").val() == "") {
		$("#account").focus();
		$("#account").css({'background-color':'orange'});
		return false;
	}
	else if ($("#password").val() == "") {
		$("#password").focus();
		$("#password").css({'background-color':'orange'});
		return false;
	}

	//post
	$("#submit").hide();
	$("#wait").show();
	$.post("/?admincp=auth-login", {
		account: $('#account').val(),
		password: $('#password').val()
	},

	function(data) {
		if(data != "OK") {
			$("#wait").hide();
			$("#submit").show();
			$("#account-message").css({'font-weight':'bold', 'background-color':'red'});
			$("#account-message").html(data);
			//$("#dialog").dialog({ title: '오류', buttons: { "Ok": function() { $(this).dialog("close"); } }, modal:true, resizable:false });
		}
		else {
			$('#wait').show();
			$("#submit").hide();
			location.href = "/?admincp=home";
		}
	});
	return false;
});


